package main

import (
	"learngo/delegate/button"
	"learngo/delegate/common"
	"learngo/delegate/label"
	"learngo/delegate/listbox"
	"fmt"
)

func main() {
	lable := label.Label{
		W: label.Widget{1,2},
		T: "lable",
	}
	button1 := button.Button{
		Label: label.Label{
			W: label.Widget{11, 12},
			T: "button1",
		},
	}

	var button2 button.Button
	b2 := button2.CreateButton(21, 22, "button2")

	listBox := listbox.ListBox{
		W: label.Widget{31,32},
		Texts: []string{"AL", "AK", "AZ", "AR"},
		Index:0,
	}

	for _,drawer := range []common.Drawer{lable,button1,b2, listBox} {
		drawer.Draw()
	}
	fmt.Println()
	//interface{}是一种类型
	for _,i := range []interface{}{lable,button1,b2, listBox} {
		if clicker,ok:= i.(common.Clicker); ok {
			clicker.Click()
		}
	}


}
